#!/bin/bash
j_script_dir=`dirname $0`
j_jenny_root_dir=`(cd $j_script_dir/..; pwd)`

. $j_jenny_root_dir/common/function

usage() {
	echo "jenny clean project"
	exit 0
}
if [ "$1" = "-h" ]; then 
	usage
fi

detect_cmake j_cmake
parse_args $@

j_defines="-DPROJECT_FILE=$j_config_path -DCMAKE_BUILD_TYPE=$j_config -DJ_TARGET_PLATFORM=$j_platform  -DJ_ARCHITECTURE=$j_architecture -DJ_TOOLSET=$j_toolset -DJ_TOOLSET_VER=$j_toolset_ver"

output=`$j_cmake $j_defines -P $j_jenny_root_dir/cmake/prepare.cmake`
for i in $output ; do eval ${i##--}; done

[ -d $j_project_output_root_dir ] && rm -rf $j_project_output_root_dir

[ -d $j_project_output_root_dir ] && die "Failed to clean"

echo "Done. you may need to clean run folder $j_output_root_dir/run."

